package com.javafamily.controller;

import com.javafamily.producer.PetsProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PetsController {
    // 将生产者注入
    @Autowired
    private PetsProducer producer;

    @PostMapping("/msg/send")
    public String sendHandler(@RequestParam("message") String msg) {
        // 生产者发送消息
        return producer.sendMessage(msg);
    }
}
